<include file="public/header"/>

<body>

<!--main-->
<style type="text/css">
body{ background:#f4f4f4;}
</style>
<div class="pplay-head clearfix">
  <a href="{:U('Goods/detail',array('itemid' => $detail['goods_id']))}">
    <h3 class="t">{$config.index_company_name}</h3>
    <div class="c">
      {$detail.goods_name}
    </div>
  </a>
  <a href="{:U('User/center')}">
    <div class="pic">
      <img src="{$user.head_img}">
    </div>
  </a>
</div>
<div class="pplay-date clearfix">
  <ul class="pplay-date-list clearfix">

    <volist name="times" id="times" key="k">
      <li <if condition="$k eq 1">class="active"</if>  data-time="{:date('Y-m-d',$times.start_time)}"  data-week="{$times.font}"  id="{:date('Y-m-d',$times.start_time)}" >
      <p class="d">{$times.font}</p>
      <p class="y">{:date('d',$times.start_time)}</p>
    </li>
    </volist>
  </ul>


 <!-- <a href="javascript:;" class="pplay-date-more">更多日期</a> -->
  <!--弹出更多日期-->
  <!--<div class="pplay-date-pup">
    <ul class="pplay-date-list">
      <volist name="times2" id="times2" key="k2">
      <li data-time="{:date('Y-m-d',$times2.start_time)}" data-week="{$times2.font}"  id="{:date('Y-m-d',$times2.start_time)}" >
        <p class="d">{$times2.font}</p>
        <p class="y">{:date('d',$times2.start_time)}</p>
      </li>
      </volist>
    </ul>
  </div>-->
  <!--弹出更多日期 End-->
</div>

<div id="ajax_return">

</div>

<form id="YD">
  <input type="hidden" name="yd_date" id="yd_date" value="{:date('Y-m-d',$now.time)}" />
  <input type="hidden" name="yd_week" id="yd_week" value="{$now.week}" />
  <input type="hidden" name="yd_time" id="yd_time" value="9:00" />
  <input type="hidden" name="goods_id" id="goods_id" value="{$detail.goods_id}">
  <input type="hidden" name="duoxuan" id="duoxuan">
</form>
<!--main End--> 

<script>
    var goods_id = $('#goods_id').val();

    $(document).ready(function(){
        var time_id = $('#subscribe-date').html();
        $.ajax({
            type : "POST",
            url:"/index.php?m=home&c=Index&a=ajax_subscribe",//+tab,
            data:{time:time_id,goods_id:goods_id},
            success: function(data){
                //console.log(data);
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    });


    $(function () {
        $(".pplay-date-list li").each(function(){
            $(this).click(function () {
                $(this).addClass('active').siblings('li').removeClass('active');
                var time = $(this).attr('data-time');
                var week = $(this).attr('data-week');
                $('#subscribe-date').html(time);
                $('#yd_date').val(time);
                $('#yd_week').val(week);
                $('#subscribe-week').html(week);
                $.ajax({
                    type : "POST",
                    url:"/index.php?m=home&c=Index&a=ajax_subscribe",//+tab,
                    data:{time:time,goods_id:goods_id},
                    success: function(data){
                        $("#ajax_return").html('');
                        $("#ajax_return").append(data);
                        $(".pplay-date-list li").removeClass('active');
                        $("[id='" + time + "']").addClass('active');
                    }
                });
            })
        });
    })
</script>


<!--弹窗-->
<div class="pFill-marsk">
</div>
<div class="pFill-pup" style="padding:15px 0;">
  <a href="javascript:;" class="close iconfont">&#xe60c;</a>
  <div class="pFill-pup-head clearfix">
    <div class="pic">
      <img src="{$user.head_img}">
    </div>
    <span class="kai">开球时间</span>
    <div class="time">
      <span id="subscribe-date">{:date('Y-m-d',$now.time)}</span>
      <label id="subscribe-week">{$now.week}</label>
      <span id="subscribe-time">9:00</span>
      <label id="subscribe-long">共计1小时</label>
    </div>
  </div>


<!--  <a href="javascript:;" onClick="select_coach()" >-->
<!--    <div class="pFill-pup-choose">-->
<!--      顾问、教练选择 <span class="c-orange">(非必选)</span>-->
<!--    </div>-->
<!--  </a>-->

  <a href="javascript:;"  >
    <div class="pFill-pup-choose">
      推荐商品 <span class="c-orange">(非必选)</span>
    </div>
  </a>


  <div class="pFill-pup-coachBox">
    <div class="pFill-pup-coach"  style="min-height: 100px;">
      <ul class="swiper-wrapper clearfix">

<!--        <volist name="coachs" id="coachs">-->
<!--          <li class="swiper-slide">-->
<!--            <div class="pic">-->
<!--              <a href="{:U('Coach/detail',array('itemid' => $coachs.coach_id))}">-->
<!--                <img src="{$coachs.head_img|head_img}">-->
<!--              </a>-->
<!--            </div>-->
<!--          </li>-->
<!--        </volist>-->



        <volist name="list" id="vo">


          <li class="swiper-slide" style="width:60px; height: 60px;margin-left: -2%;">
            <div class="pic" style="width: 60px;height: 100% ">
              <a   href="{:U('Goods/goods_detail',array('item_id' => $vo.goods_id))}">
                <img style="border-radius: 50%; width: 100%;height: 100%" src="{$vo.original_img|head_img}">
              </a>
              <div style="position: absolute;z-index: 1;width: 100%;text-align: center; overflow: hidden;text-overflow: ellipsis;white-space: nowrap" >
                {$vo.goods_name}
              </div>
            </div>
          </li>
        </volist>

      </ul>
    </div>
  </div>
  <div class="pFill-pup-prompt">
    <dl class="clearfix">
      <dt>温馨提醒</dt>
      <dd>如有任何疑问，可随时与客服联系。</dd>
    </dl>
    <dl class="clearfix">
      <dt>取消须知</dt>
      <dd>
        <p>1、预约开球时间前2个小时取消全额退款</p>
        <p>2、预约开球时间2小时内(含)取消订单扣除20%退订费</p>
        <p>3、若已到预约开球时间则不可取消订单</p>
      </dd>
    </dl>
  </div>
  <a href="javascript:;" class="btn" style="width:calc(100% - 20px); margin:auto;" onClick="add_order()" >全额付款￥<strong id="subscribe-price"></strong>立即预定</a>
</div>
<!--弹窗 End--> 

<!--footer-->
<include file="public/footer"/>
<!--footer End-->

<script>

  //选择教练
  function select_coach() {
      $.ajax({
          type : "POST",
          url: '/home/index/reserve.html',
          data : $('#YD').serialize(),// 你的formid
          dataType: 'json',
          success: function(data){
              if(data.status==200){
                  window.location.href = "{:U('Coach/index')}";
              }else{
                  window.location.href = "{:U('User/login')}";
              }}
      });
  }

  //前往下单页面
  function add_order(){
      $.ajax({
          type : "POST",
          url: '/home/order/place_order.html',
          data : $('#YD').serialize(),// 你的formid
          dataType: 'json',
          success: function(data){
              if(data.status==200){
              		//console.log(data.result);
                  window.location.href = "{:U('Order/place_order')}";
              }else{
                  window.location.href = "{:U('User/login')}";
              }}
      });
  }
</script>

</body>
</html>
